const TransformPages = require('uni-read-pages')
const {
	webpack
} = new TransformPages()
module.exports = {
	// 正确示范
	devServer: {
		proxy: {
			'/api': {
				target: 'http://localhost:9527',
				changeOrigin: true,
				// pathRewrite: {
				//     ['^/api']: '/api'
				// }
			}
		}
	},
	configureWebpack: {
		plugins: [
			new webpack.DefinePlugin({
				ROUTES: webpack.DefinePlugin.runtimeValue(() => {
					const tfPages = new TransformPages({
						includes: ['path', 'name', "meta", 'aliasPath']
					});
					return JSON.stringify(tfPages.routes)
				}, true)
			})
		]
	}
}
